package com.itbaima.controller;

import com.itbaima.domain.User;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

@RestController
public class HelloController {

    @RequestMapping("/hello")
    public String hello() {
        return "hello";
    }

    @RequestMapping("/testPath")
    public String testPath() {
        return "testPath";
    }

//    @RequestMapping(value = "/testMethod", method = RequestMethod.POST)
    @PostMapping(value = "/testMethod")
    public String testMethod() {
        System.out.println("testMethod处理了请求");
        return "testMethod";
    }

    @RequestMapping(value = "/user", method = RequestMethod.POST)
    public String insertUser(@RequestBody User user) {
        System.out.println(user);
        return "insertUser";
    }

    @RequestMapping("/testRequestParam")
    public String testRequestParam(Integer id, String name, String[] likes){
        System.out.println("testRequestParam");
        System.out.println(id);
        System.out.println(name);
        System.out.println(Arrays.toString(likes));
        return "testRequestParam";
    }

}
